Request

Response

    Using the AEC Data Model API

    To access the AEC Data Model API, follow these steps:

    • If you are using this API for the first time, follow these steps:

      • Sign up for an APS account.
      • Create an App.
      • Select the AEC Data Model API, Data Management API, Model Derivative API, and Webhooks API services to use the AEC Data Model API.
      • Note down the Client ID and Client secret so that you have the Client ID and Client secret readily available for future reference.

    • To add AEC Data Model service to an existing APS account then select the AEC Data Model API, Data Management API, Model Derivative API, and Webhooks API services to use the AEC Data Model API. For more information refer to Add Forge Services to Existing App.

    Endpoint

    All the GraphQL queries must be sent to https://developer.api.autodesk.com/aecdatamodel/graphql.

    Obtain a 3-Legged access token to authenticate queries

    All AEC Data Model API queries require a 3-legged access token. See Get a 3-Legged Token with Authorization Code Grant for instructions on how to obtain a 3-legged access token. Make sure that you specify the following scopes:

    data:read data:create data:write
    

    Executing GraphQL queries

    You can execute GraphQL queries by sending a POST request to https://developer.api.autodesk.com/aecdatamodel/graphql. Each request must have an Authorization header, which must be Bearer <YOUR_ACCESS_TOKEN>. For example;

    Request

    curl -v 'https://developer.api.autodesk.com/aecdatamodel/graphql' \
    -X 'POST' \
    -H 'Authorization: Bearer AuIPTf4KYLTYGVnOHQ0cuolwCW2a' \
    -H 'Content-Type: application/graphql' \
    -d '{
          hubs {
            results {
              name
            }
          }
        }'
    
    Show More

    Response

    {
      "data": {
        "hubs" : {
          "results" : [
            {
              "name" : "Autodesk-Forge"
            },
            {
              "name" : "ME-FLC"
            },
            {
              "name" : "ACC-Cloud-Team"
            },
            {
              "name" : "PIM-ME-Release"
            }
          ]
        }
      }
    }
    
    Show More


    Specifying the Content Type Header

    The Content-Type header plays a vital role in indicating the request format. When working with the GraphQL API endpoint, the value for the Content-Type header depends on the data format used (as in the cURl code sample as described previously). If the data is sent in GraphQL format, the Content-Type should be set as application/graphql. However, some clients like Axios format the GraphQL query as a JSON object instead as shown in the following code block.

    axios({
      method: 'POST',
      url: '<GraphQL endpoint>',
      data: {
        query: `{
          hubs {
            results {
              name
            }
          }
        }`
      }
    })
    
    Show More

    Axios automatically sets the Content-Type header value to application/json.